home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Science
/
RLaB
/
examples
/
ode_examples.r
< prev
next >
Wrap
Text File
|
1994-04-25
|
645b
|
37 lines
//
// Integrate the Van der Pol equation
//
vdpol = function ( t , x )
{
local(xdot);
xdot[1;1] = x[1] * (1 - x[2]^2) - x[2];
xdot[2;1] = x[1];
return xdot;
};
vdpol_out = function ( t , x )
{
return [t; x; 2*x];
};
// system( "/usr/ucb/ps -aux | grep rlab" );
t0 = 0;
tf = 20;
x0 = [0; 0.25];
tic();
//out = ode23( vdpol, t0, tf, x0, vdpol_out);
//rfile ode78
//out = ode78( vdpol, t0, tf, x0, vdpol_out );
rfile ode4
out = ode4( vdpol, t0, tf, x0, vdpol_out );
printf(" Elapsed integration time: %i\n", toc() );
plgrid ();
ptitle ( "RLaB ODE Example (vdpol)" );
xlabel ( "Time (seconds)" );
ylabel ( "States" );
plot( out );